﻿@model PagedList<ForwardTongJi>
@{
    ViewBag.Title = "商品转发统计";
    Layout = "~/Views/Shared/_ContentLayout.cshtml";

    ForwardTongJiQueryModel paramModel = new ForwardTongJiQueryModel();
    if (ViewBag.paramModel != null)
    {
        paramModel = (ForwardTongJiQueryModel)ViewBag.paramModel;
    }
}


<form id="S_Form" class="form-inline definewidth m20" action="@Url.Action("GoodsForwardTongJi", "finance")" method="get">
    <div class="form_query">
        <info style="float:left;">供应商名称：</info>
        <div id="supplier_name"></div>
        <info style="float:left;">&nbsp;品牌名称：</info>
        <div id="brand_name"></div>
        <info style="float:left;">&nbsp;分类名称：</info>
        <div id="category_name"></div>
        <div>
            &nbsp;转发日期：
            <input type="text" name="beg_time" class="calendar" id="beg_time" value="@paramModel.beg_time.ToString(2)"> - <input type="text" name="end_time" class="calendar" id="end_time" value="@paramModel.end_time.ToString(2)">&nbsp;
        </div>
        <div>
            @{Html.RenderPartial(Url.Content("~/Views/Common/PageSize.cshtml"), paramModel);}
        </div><div>
            <button type="submit" class="btn btn-primary">查询</button>&nbsp;&nbsp;
        </div>
    </div>
</form>

<table class="table table-bordered table-hover definewidth m10">
    <thead>
        <tr>
            <th>商品</th>
            <th>转发日期</th>
            <th>转发次数</th>
        </tr>
    </thead>
    @if (Model != null && Model.Count != 0)
    {
        int index = 0;
        foreach (var m in Model)
        {
            index++;
            <tr class="@HtmlPagerHelper.TrClass(index)">
                <td>@m.goods_id @m.mpn</td>
                <td>@m.forward_date.ToString(6)</td>
                <td>@m.num</td>
            </tr>
        }
    }
</table>
<div class="inline pull-left total">
    总行数：@ViewData["AllCount"]
</div>
<div class="inline pull-right page">
    @if (Model != null)
    {
        @Html.Pager(Model, HtmlPagerHelper.BasePagerOption)
    }
</div>
<script type="text/javascript">
        BUI.use('bui/select', function (Select) {
            var s = '@paramModel.supplier_name';
            var b = '@paramModel.brand_name';
            var c = '@paramModel.category_name';

            $.post('@Url.Action("getselect", "common")', { selectType: 2 }, function (result) {
                var suggest = new Select.Suggest({
                    render: '#brand_name',
                    name: 'brand_name',
                    data: result
                });
                suggest.render();
                $("input[name='brand_name']").val(b);
                $("input[name='brand_name']").attr("autocomplete", "off");
            });

            $.post('@Url.Action("getselect", "common")', { selectType: 3 }, function (result) {
                var suggest = new Select.Suggest({
                    render: '#category_name',
                    name: 'category_name',
                    data: result
                });
                suggest.render();
                $("input[name='category_name']").val(c);
                $("input[name='category_name']").attr("autocomplete", "off");
            });

            $.post('@Url.Action("getselect", "common")', { selectType: 1 }, function (result) {
                var suggest = new Select.Suggest({
                    render: '#supplier_name',
                    name: 'supplier_name',
                    data: result
                });
                suggest.render();
                $("input[name='supplier_name']").val(s);
                $("input[name='supplier_name']").attr("autocomplete", "off");
            });
    });
</script>